import { Routes, Route, Navigate, } from 'react-router-dom'
import Login from './views/Login';
import HomeViews from './views/HomeViews';
import JsglViews from './views/JsglViews';
import QxglViews from './views/QxglViews';
import YhglViews from './views/YhglViews';
import Page404 from './views/Page404';
function App() {
  return (
    <div className="App">

      <Routes>
        <Route path='/' element={<Navigate to="/login" replace={true} />}></Route>

        <Route path='/login' element={<Login />} ></Route>
        <Route path='/home' element={<HomeViews />} >
          {/* 嵌套子路由，path会自动与父级Path合并， */}
          <Route path='qxgl' element={<QxglViews />} />
          <Route path='jsgl' element={<JsglViews />} />
          {/* 动态路由 */}
          <Route path='yhgl/:id' element={<YhglViews />} />
          <Route path='yhgl' element={<YhglViews />} />
          {/* 设置默认子路由， 再HomeViews组件中，添加 <Outlet/>组件，接收子路由的输出 */}
          <Route index element={<YhglViews />} />
        </Route>
        {/* 404 */}
        <Route path="*" element={<Page404 />} />
      </Routes>
    </div>
  );
}

export default App;
